#include <iostream>
#include <unistd.h>
#include <signal.h>

void sigcb(int sig)
{
    std::cout << "get a sig : " << sig << std::endl;
}

int main()
{
    signal(2, sigcb);
    while (true)
    {
        std::cout << "process is running , pid : " << getpid() << std::endl;
        sleep(1);
    }
    return 0;
}